import request from '@/utils/request'

// 获取课程列表
export function getCourseList(pageNum, pageSize, orderBy, course) {
  return request({
    url: `/course/findall/${pageNum}/${pageSize}/${orderBy}`,
    method: 'post',
    data: course
  })
}

// 添加课程
export function addCourse(course) {
  return request({
    url: '/course/insert',
    method: 'post',
    data: course
  })
}

// 更新课程
export function updateCourse(course) {
  return request({
    url: '/course/update',
    method: 'put',
    data: course
  })
}

// 删除课程
export function deleteCourse(courseId) {
  return request({
    url: `/course/delete/${courseId}`,
    method: 'delete'
  })
}

// 获取课程详情
export function getCourseDetail(courseId) {
  return request({
    url: `/course/${courseId}`,
    method: 'get'
  })
}

// 获取课程关联的班级
export function getClasssByCourseId(courseId) {
  return request({
    url: `/course/id/${courseId}`,
    method: 'get'
  })
}

// 获取课程的学生
export function getStudentByCourse(courseId) {
  return request({
    url: `/course/classs/${courseId}`,
    method: 'get'
  })
}
